<?php

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

defined('_JEXEC') or die;

jimport('joomla.application.component.modelitem');

class CprojectModelCproject extends JModelItem {

    protected $_item = null;

    function populateState() {
        $app = JFactory::getApplication();
        $params = $app->getParams();

        // Load the object state.
        $id = JRequest::getInt('id');
        $this->setState('cproject.id', $id);
    }

    public function getTable($name = 'Cproject', $prefix = 'Table', $options = array()) {
        return parent::getTable($name, $prefix, $options);
    }

    function &getItem($id=null) {

        $this->_db = JFactory::getDbo();
      
        if ($this->_item == null) {
          
            if (empty($id)) {
                $id = $this->getState('cproject.id');
            }
           $where = array(
			'a.published = 1',
			'a.id = '.$id
		);
		
		$this->_item= CprojectDBHelper::getCprojects($sql = false, $where);
            
        }
        return $this->_item;
    }

}

?>